{extend name="../app/admin/view/base.html" /}

{block name="body"}
<form class="layui-form model-form" id="thisForm">
    {:tpl_fourth_menu()}
    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">APP_KEY</label>
        <div class="layui-input-block">
            <input name="form[key]" class="layui-input" lay-verify="required" value="{$data['key'] ?? ''}"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">SECRET_KEY</label>
        <div class="layui-input-block">
            <input name="form[secret]" class="layui-input" lay-verify="required" value="{$data['secret'] ?? ''}"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">短信内容签名</label>
        <div class="layui-input-block">
            <input name="form[sign]" class="layui-input" lay-verify="required" value="{$data['sign'] ?? ''}"/>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-filter="formSubmit" lay-submit>保存</button>
            <button class="layui-btn layui-btn-primary" type="reset" >重置</button>
        </div>
    </div>
</form>
{/block}

{block name="script"}
<script>
    layui.use(['layer', 'form', 'table'], function () {
        var $ = layui.jquery, form= layui.form;

        // 表单提交
        form.on('submit(formSubmit)', function (data) {
            let formData = data.field;
            $.post('/alidayu/admin/index/config', formData, function(res){
                layer.msg('保存成功!');
            })
            return false;
        });
    })
</script>
{/block}